package com.supplychainapi;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;


@ServletComponentScan
@ComponentScan("com.supplychainapi.*")
@EnableScheduling
@ImportResource({"classpath:sms.xml"})
@SpringBootApplication
public class MainApplicion {

    private static Logger logger = LogManager.getLogger(MainApplicion.class);

    private static ClassPathXmlApplicationContext context;

	public static void main(String[] args) throws Exception {
//		// 启动Sring discnf 下载配置文件
		context = new ClassPathXmlApplicationContext(new String[] { "application-context.xml" });
		// 手动启动Sring
		context.start();
		// 手动关闭Sring
		context.registerShutdownHook();

		// 启动Spring boot
		SpringApplication.run(MainApplicion.class, args);
		logger.info("启动Spring boot......");
	}
}